package com.xigua.spuercost.Consumer;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.stream.Collectors;

public class MapSort {
    public static void main(String[] args) {
        Map<String,String> requestData = new HashMap<>();
        requestData.put("qa", "121");
        requestData.put("qb", "122");
        requestData.put("qc", "123");
        requestData.put("qd", "124");
        requestData.put("qe", "125");
        requestData.put("qf", "126");

        Map<String, String> resultData = new HashMap<>();
        resultData = requestData.entrySet().stream().sorted(Map.Entry.comparingByKey()).
                collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
                        (oldValue, newValue) -> oldValue, LinkedHashMap::new));
        System.out.println(resultData);
    }
}
